
DEFINE VARIABLE ret AS INTEGER.

DEFINE VARIABLE prtName AS CHARACTER.
DEFINE VARIABLE paperName AS CHARACTER.
DEFINE VARIABLE pName AS MEMPTR.

DEFINE VARIABLE hPrinter AS INTEGER.

DEFINE VARIABLE pForm AS MEMPTR.

prtName = "Epson LQ-300K".

RUN OpenPrinterA(INPUT prtName, OUTPUT hPrinter, INPUT 0, OUTPUT ret).

SET-SIZE(pName) = 1024.
PUT-STRING(pName, 1) = "FDN".
SET-SIZE(pForm) = 32.

PUT-LONG(pForm, 1) = 0 .        /*FORM_USER*/
PUT-LONG(pForm, 5) = GET-POINTER-VALUE(pName) .        /*pName*/
PUT-LONG(pForm, 9) = 216000 .   /*cx*/
PUT-LONG(pForm,13) = 140000 .   /*cy*/
PUT-LONG(pForm,17) = 0 .        /*left*/
PUT-LONG(pForm,21) = 0 .        /*top*/
PUT-LONG(pForm,25) = 216000 .   /*right*/
PUT-LONG(pForm,29) = 140000 .   /*bottom*/

RUN AddFormA(INPUT hPrinter , INPUT 1, INPUT pForm, OUTPUT ret).

PROCEDURE OpenPrinterA EXTERNAL "winspool.drv":

    DEFINE INPUT PARAMETER pPrinterName AS CHARACTER.
    DEFINE OUTPUT PARAMETER pPrinter AS LONG.
    DEFINE INPUT PARAMETER pDefault AS LONG.
    DEFINE RETURN PARAMETER ret AS LONG.

END.

PROCEDURE AddFormA EXTERNAL "winspool.drv":

    DEFINE INPUT PARAMETER hPrinter AS LONG.
    DEFINE INPUT PARAMETER Level AS LONG.
    DEFINE INPUT PARAMETER pForm AS MEMPTR.
    DEFINE RETURN PARAMETER ret AS LONG.
    
END.
